package jvmtest;
/**
 * Created with IntelliJ IDEA.
 *
 * @Author: Tom
 * @Date: 2022/02/04/16:44
 * @Description:
 */

import javax.crypto.NullCipher;

/**
 *@ClassName ReferenceCountingGC
 *@Description
 *@Author 王琛
 *@Date 2022/2/4 16:44
 @Version 1.0
 */
public class ReferenceCountingGC {
    public Object instance = null;
    private static final int _1MB = 1024 * 1024;
    private byte[] bigSize = new byte[2 * _1MB];
    public static void testGC(){
        ReferenceCountingGC objA = new ReferenceCountingGC();
        ReferenceCountingGC objB = new ReferenceCountingGC();
        objA.instance = objB;
        objB.instance = objA;

        objA = null;
        objB = null;

        System.gc();
    }

}
